﻿using System.Collections.Generic;
using System.Linq;

namespace Uber.Core
{
    public interface IPageableInfo
    {
        int PageCount { get; set; }
        int PageIndex { get; set; }
    }

    public interface IPageable<T> : IPageableInfo
    {
        IEnumerable<T> Page { get; set; }
    }

    public class Pageable<T> : IPageable<T>
    {
        public int PageCount { get; set; }

        public IEnumerable<T> Page { get; set; }

        public int PageIndex { get; set; }
    }

    public static class GlobalExtensions
    {
        public static IEnumerable<T> Pag<T>(this IEnumerable<T> items, int page, int ps)
        {
            return items.Skip((page - 1) * ps).Take(ps);
        }
    }
}